Digital filtering is essential to most signal processing and image understanding applications. There are several existing techniques including linear operators such as average filters and weighted average filters, and nonlinear operators such as median filters, weighted median filters, morphological filters and stack filters. In practice, the difficulty of signal filtering is not only due to the fact that there are several filtering methods, algorithms, and parameter settings, but also the complexity of discovering the most appropriate sequence of these existing filters. It would be beneficial if a computationally efficient signal processing technique can be realized that can represent several conventional linear and nonlinear filters by adjusting a set of parameters. Such a filtering technique would allow for the elimination of expensive sequences of conventional filtering operations. Moreover, from a hardware point of view, it is desired to have a unique architecture that can be used to accelerate the execution of different filters. Therefore, a need exists for a method and apparatus for filtering a signal that is computationally efficient, and allows for the elimination of expensive sequences of conventional filtering operations.